<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <title>债权合同上传</title>
  <link rel="stylesheet" th:href="@{/css/bootstrap-3.3.7.min.css}">
  <script th:src="@{/js/jquery-2.1.1.min.js}"></script>
  <script th:src="@{/js/bootstrap-3.3.7.min.js}"></script>
</head>
<body>
<form th:action="@{/fastdfs/upload}" class="form-inline" role="form" method="post" target="uploadFrame" enctype="multipart/form-data">
  <div class="form-group">
    <label class="sr-only" for="fileName">文件输入</label>
    <input type="file" id="fileName" name="fileName">
  </div>
  <input type="hidden" id="id" name="id" th:value="${id}">
  <button type="submit" class="btn btn-default">提交</button>
</form>
<iframe name="uploadFrame" style="display: none;"></iframe>
<script type="text/javascript" th:inline="javascript">
  function uploadOK(result){
    if(result == 0){
      //文件上传成功
      alert("文件上传成功");
      var contextPath = [[${#request.getContextPath()}]];
      window.location.href = contextPath + "/fastdfs/index";
    }else{
      alert("文件上传失败");
    }
  }
</script>
</body>
</html>